﻿using MongoFramework;
using Zhaoxi.MongoDBSample.Models;

namespace Zhaoxi.MongoDBSample.Data
{
    public class SchoolDbContext : MongoDbContext
    {
        public SchoolDbContext(IMongoDbConnection connection) : base(connection)
        {
        }

        public MongoDbSet<Course> Courses { get; set; } = null!;
        public MongoDbSet<Student> Students { get; set; } = null!;

        protected override void OnConfigureMapping(MappingBuilder mappingBuilder)
        {
            mappingBuilder.Entity<Student>().Ignore(student => student.CourseList);
        }
    }
}
